﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TankWin.Classes
{
    class ObjMap
    {
        public static byte[,] _map;

        public static void LoadMap(int _level)
        {
            try
            {
                System.IO.StreamReader sr = System.IO.File.OpenText("Map" + _level + ".txt");
                _map = new byte[52, 52];
                string s = "";
                int i = 0;
                while ((s = sr.ReadLine()) != null)
                {
                    int n = s.Length;
                    for (int k = 0; k < n; k++)
                    {
                        string mypoint = s[k].ToString();
                        _map[i, k] = byte.Parse(mypoint);
                    }
                    i++;
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                Application.Exit();
            }
        }
    }
}
